<template>
  <div></div>
</template>

<script setup>
import { inject, onMounted, onBeforeUnmount } from 'vue'
const { map } = inject('mapScene')
let rqid
onMounted(() => {
  rotate()
})
function rotate() {
  let center = map.getCenter()
  center.lng += 0.1
  map.setCenter(center)
  rqid = requestAnimationFrame(rotate)
}
//点击zoom控件 取消自转
const zoom = document.querySelector('.l7-control-zoom')
zoom.onclick = function () {
  cancelAnimationFrame(rqid)
}
onBeforeUnmount(() => {
  cancelAnimationFrame(rqid)
})
</script>

<style lang="scss" scoped></style>
